﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using BluePortal.Medias.Core;


namespace BluePortal.QuikStart.UserControls
{
    public partial class AddCategory : System.Web.UI.UserControl
    {
        public Guid VideoId;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                ViewState["VideoId"] = VideoId;
            }
            if (ViewState["VideoId"] != null)
            {
                VideoId = (Guid)ViewState["VideoId"]; 
            }
            odsCategory.SelectParameters["id"].DefaultValue = VideoId.ToString();            
        }

        protected void CheckBox1_CheckedChanged(object sender, EventArgs e)
        {
            BCCategory bc = new BCCategory();
            CheckBox cb = (CheckBox)sender;
            if (cb.Checked)
                bc.Add(new Guid(cb.Attributes["tag"]), VideoId);
            else
                bc.Remove(new Guid(cb.Attributes["tag"]), VideoId);
        }
    }
}